/*
 * @Description:
 * @Author: chenju
 * @Date: 2023-02-01 16:57:02
 * @LastEditors: chenju
 * @LastEditTime: 2023-02-01 17:18:46
 */
import { isNumber, isBoolean } from '@vueuse/core';
export { isBoolean };
import { isString } from '@vue/shared';
import { fromPairs } from 'lodash';

export const isStringNumber = (val: string): boolean => {
  if (!isString(val)) {
    return false;
  }
  return !Number.isNaN(Number(val));
};

export function addUnit(value?: string | number, defaultUnit = 'px') {
  if (!value) return '';
  if (isNumber(value) || isStringNumber(value)) {
    return `${value}${defaultUnit}`;
  } else if (isString(value)) {
    return value;
  }
}
